package com.gvtv.main.schedul;

import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

import com.gvtv.main.job.JobInfo;

public class SchedulInfo {

	private String id;
	private String name;
	private String startTime;
	private String endTime;
	private String cron;
	private List<JobInfo> jobs;
	private Map<String, String> env;
	
	public SchedulInfo() {
		super();
	}
	
	public String getId() {
		return id;
	}
	public void setId(String id) {
		this.id = id;
	}
	public String getName() {
		return name;
	}
	public void setName(String name) {
		this.name = name;
	}
	public String getStartTime() {
		return startTime;
	}
	public void setStartTime(String startTime) {
		this.startTime = startTime;
	}
	public String getEndTime() {
		return endTime;
	}
	public void setEndTime(String endTime) {
		this.endTime = endTime;
	}
	public String getCron() {
		return cron;
	}
	public void setCron(String cron) {
		this.cron = cron;
	}
	public List<JobInfo> getJobs() {
		return jobs;
	}
	public void setJobs(List<JobInfo> jobs) {
		this.jobs = jobs;
	}
	public void addJobInfo(JobInfo jobInfo){
		if(this.jobs==null){
			this.jobs = new ArrayList<JobInfo>();
		}
		this.jobs.add(jobInfo);
	}
	
	public Map<String, String> getEnv() {
		return env;
	}

	public void setEnv(Map<String, String> env) {
		this.env = env;
	}

	public void addEnv(String key, String value){
		if(this.env==null){
			this.env = new HashMap<String, String>();
		}
		if(env.containsKey(key)){
			env.remove(key);
		}
		this.env.put(key, value);
	}
	@Override
	public String toString() {
		return "SchedulInfo:[id="+this.getId()+", name="+this.getName()+", startTime="+this.getStartTime()+", endTime="+this.getEndTime()+", cron="+this.getCron()+"]";
	}
	
}
